package com.zzyl.controller.customer;

import com.zzyl.base.PageResponse;
import com.zzyl.base.ResponseResult;
import com.zzyl.service.NursingProjectService;
import com.zzyl.vo.NursingProjectVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static com.zzyl.base.ResponseResult.success;

@RestController
@RequestMapping("/customer/orders/project")
@Api(tags = "客户订单项目管理")
public class CustomerOrdersProjectController {

    @Autowired
    private NursingProjectService nursingProjectService;

    @GetMapping("/page")
    @ApiOperation(value = "分页查询护理项目列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "name", value = "护理项目名称", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "pageNum", value = "页码", dataType = "integer", paramType = "query", defaultValue = "1", required = true),
            @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "integer", paramType = "query", defaultValue = "10", required = true),
            @ApiImplicitParam(name = "status", value = "状态", dataType = "integer", paramType = "query", required = false)
    })
    public ResponseResult<PageResponse> selectByPage(String name, Integer pageNum,Integer pageSize,Integer status){
        PageResponse pageResponse = nursingProjectService.selectByPage(name, pageNum, pageSize, status);

        return success(pageResponse);
    }

    @GetMapping("/{id}")
    @ApiOperation(value = "根据编号查询护理项⽬信息")
    public ResponseResult<NursingProjectVo> selectById(@PathVariable Long id){
        NursingProjectVo nursingProjectVo = nursingProjectService.selectByID(id);
        return success(nursingProjectVo);
    }

}
